/* 场景类 */
export default class Stage {
  constructor(root, word, showName, hideName) {
    this.setRoot(root);
    this.setWord(word);
    this.setShowName(showName);
    this.setHideName(hideName);
  }
  setRoot(root) {
    this.root = root;
  }
  setWord(word) {
    this.word = word;
  }
  setShowName(showName) {
    this.showName = showName;
  }
  setHideName(hideName) {
    this.hideName = hideName;
  }
  show() {
    $(this.root)
      .removeClass(this.hideName)
      .addClass(this.showName);
  }
  hide() {
    $(this.root).removeClass(this.showName);

    let tmp = this.hideName;

    this.hideName = this.showName;
    this.showName = tmp;
  }
  stopWord() {
    this.word.stop();
    this.word.emptyWord();
    this.word.removeAudio();
  }
  run() {
    this.word.emptyWord();
    this.word.run();
    this.show();
  }
}
